package eu.floranet.repositorio.sql;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "interface_objecto_permissao")
public class RelationObjectoPermissao implements Serializable {
	@Id
	private int ifaceobjectopermissao;

	@Column(name = "op_interface_user")
	private int opUser;

	@Column(name = "op_interface_grupo")
	private int opGrupo;

	@Column(name = "op_interface_read")
	private int opRead;

	@Column(name = "op_interface_write")
	private int opWrite;

	@Column(name = "op_interface_edit")
	private int opEdit;

	@Column(name = "op_interface_delete")
	private int opDelete;

	@Column(name = "op_interface_view")
	private int opView;

	@Column(name = "op_interface_admin")
	private int opAdmin;

	@ManyToOne
	@JoinColumn(name = "op_interface_objecto")
	private SysObjectos opObjecto;

	private static final long serialVersionUID = 1L;

	public RelationObjectoPermissao() {
		super();
	}

	public RelationObjectoPermissao(int UserGrupo, int opRead, int opWrite,
			int opEdit, int opDelete, int opView, int opAdmin,
			SysObjectos opObjecto, boolean groupMode) {
		
		this();
		
		if(groupMode){
			setOpGrupo(UserGrupo);
		} else {
			setOpUser(UserGrupo);
		}
		
		setOpRead(opRead);
		setOpWrite(opWrite);
		setOpEdit(opEdit);
		setOpDelete(opDelete);
		setOpView(opView);
		setOpAdmin(opAdmin);
		setOpObjecto(opObjecto);
	}
	
	public int getIfaceobjectopermissao() {
		return this.ifaceobjectopermissao;
	}

	public void setIfaceobjectopermissao(int ifaceobjectopermissao) {
		this.ifaceobjectopermissao = ifaceobjectopermissao;
	}

	public int getOpUser() {
		return this.opUser;
	}

	public void setOpUser(int opUser) {
		this.opUser = opUser;
	}

	public int getOpGrupo() {
		return this.opGrupo;
	}

	public void setOpGrupo(int opGrupo) {
		this.opGrupo = opGrupo;
	}

	public int getOpRead() {
		return this.opRead;
	}

	public void setOpRead(int opRead) {
		this.opRead = opRead;
	}

	public int getOpWrite() {
		return this.opWrite;
	}

	public void setOpWrite(int opWrite) {
		this.opWrite = opWrite;
	}

	public int getOpEdit() {
		return this.opEdit;
	}

	public void setOpEdit(int opEdit) {
		this.opEdit = opEdit;
	}

	public int getOpDelete() {
		return this.opDelete;
	}

	public void setOpDelete(int opDelete) {
		this.opDelete = opDelete;
	}

	public int getOpView() {
		return this.opView;
	}

	public void setOpView(int opView) {
		this.opView = opView;
	}

	public int getOpAdmin() {
		return this.opAdmin;
	}

	public void setOpAdmin(int opAdmin) {
		this.opAdmin = opAdmin;
	}

	public SysObjectos getOpObjecto() {
		return this.opObjecto;
	}

	public void setOpObjecto(SysObjectos opObjecto) {
		this.opObjecto = opObjecto;
	}

}
